package com.ssy.lingxi.order.repository;

import com.ssy.lingxi.order.entity.OrderProductDO;
import com.ssy.lingxi.order.entity.OrderPromotionDO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 订单关联的营销活动Jpa仓库
 * @author 万宁
 * @version 2.0.0
 * @date 2021-09-23
 */
@Repository
public interface OrderPromotionRepository extends JpaRepository<OrderPromotionDO, Long>, JpaSpecificationExecutor<OrderPromotionDO>, QuerydslPredicateExecutor<OrderPromotionDO> {
    List<OrderPromotionDO> findByProduct(OrderProductDO product);

    Page<OrderPromotionDO> findAllByProduct(OrderProductDO product, Pageable pageable);
}
